import { ILoadMapTypeAll } from '@/common';
import { ManageCommonAPI } from '@/pages/type';
import { getLevelFirstJson, getLevelZeroJson, getSelectDataCommon, getTenantID } from '@/utils';

const getSearchList = (loadMdicMapList: Record<string, any>, queryTypeObj: Record<string, any>): ManageCommonAPI.ISearchList => {
  // 流程类别状态
  const orderTypeList = getSelectDataCommon(loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.ALLFLOW_TYPE}`], 'name', 'id');

  // let orgDeptList: any[] = [];
  // if (queryTypeObj?.params == 'createCompanyID') {
  //   orgDeptList = getLevelZeroJson();
  // } else if (queryTypeObj?.params == 'createDepartmentID') {
  //   orgDeptList = getLevelFirstJson();
  // }

  return [
    {
      name: 'orderType',
      placeholder: '业务名称',
      label: '业务名称',
      componentType: 'Select',
      dataSource: orderTypeList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'name',
    },
    {
      name: 'warnInfo',
      placeholder: '预警内容',
      label: '预警内容',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: 'readFlag',
      placeholder: '是否已读',
      label: '是否已读',
      componentType: 'Select',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      dataSource: [
        {
          name: '已读',
          id: '1',
          value: '1',
        },
        {
          name: '未读',
          id: '0',
          value: '0',
        },
      ],
      searchParams: {
        fieldType: 'Integer',
        fieldParam: 1,
        fieldUse: 0,
        searchType: 1,
        isSearch: 0,
        seq: 0,
      },
    },
    {
      name: 'readTime',
      placeholder: '阅读',
      label: '阅读时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'Date',
        fieldParam: 0,
        fieldUse: 0,
        isSearch: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: queryTypeObj?.params,
      placeholder: '权限参数',
      label: '权限参数',
      componentType: 'QueryParams',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        // fieldParam: 5,
        fieldParam: queryTypeObj?.params == 'ownerID' ? '2' : '3',
        fieldUse: 0,
        searchType: 2,
        seq: 0,
      },
    },
  ];
};

export { getSearchList };
